//
//  DCBankCardCell.m
//  Demo
//
//  Created by zhaolin on 2023/1/4.
//

#import "DCBankCardCell.h"

#import "DCBankCardModel.h"

@interface DCBankCardCell ()
@property (nonatomic, strong) UILabel *titleLabel;

@property (nonatomic, strong) UILabel *rightLabel;
@end
@implementation DCBankCardCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self configureUI];
    }
    return self;
}
- (void)setData:(DCProductModel *)model {
    _titleLabel.text = [NSString stringWithFormat:@"GO %@",model.productName];
    _rightLabel.text = [NSString stringWithFormat:@"₦ %@",model.amount];
}
- (void)configureUI {
    self.backgroundColor = [UIColor colorWithString:@"#FFFFFF"];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UIView *colorView = [UIView new];
    colorView.backgroundColor = [UIColor colorWithString:@"#F7F7F7"];
    colorView.layer.cornerRadius = 4;
    colorView.layer.masksToBounds = YES;
    [self.contentView addSubview:colorView];
    [colorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(35);
        make.right.mas_equalTo(-35);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(-14);
    }];
    
    UIImageView *colorImage = [UIImageView new];
    colorImage.backgroundColor = [UIColor colorWithString:@"#1C221B"];
    colorImage.layer.cornerRadius = 8;
    colorImage.layer.masksToBounds = YES;
    [colorView addSubview:colorImage];
    [colorImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(30);
        make.left.mas_equalTo(15);
        make.centerY.mas_equalTo(colorView.mas_centerY);
    }];
    
    _titleLabel = [UILabel new];
    _titleLabel.text = @"#1C221B";
    _titleLabel.font = DCFont_PF_Regular(14);
    _titleLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    [colorView addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(colorImage.mas_right).mas_offset(14);
        make.centerY.mas_equalTo(colorImage);
    }];
    
    _rightLabel =  [UILabel new];
    _rightLabel.text = @"#1C221B";
    _rightLabel.textColor = [UIColor colorWithString:@"#1C221B"];
    _rightLabel.font = DCFont_PF_Regular(14);
    [colorView addSubview:_rightLabel];
    [_rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(colorImage);
        make.right.mas_equalTo(-30);
    }];
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
